package com.test.langchain4j.controller;

import com.test.langchain4j.service.MapMcpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * Created with IntelliJ IDEA.
 *
 * @description: 第1步，如何进行mcp编码
 *     https://docs.langchain4j.dev/tutorials/mcp#creating-an-mcp-tool-provider
 *     <p>第2步，如何使用baidu map mcp，它提供了哪些功能对外服务 https://mcp.so/zh/server/baidu-map/baidu-maps?tab=tools
 *     <p>http://localhost:9014/mcp/chat?question=查询61.149.121.66归属地
 *     http://localhost:9014/mcp/chat?question=查询北京天气
 *     http://localhost:9014/mcp/chat?question=查询昌平到天安门路线规划
 * @author: liuziyang
 * @since: 2025/8/6 16:15
 * @modifiedBy:
 * @version: 1.0
 */
@RestController
public class MapMcpCallServerController {
  @Autowired
  @Qualifier("baiduMapMcpService")
  private MapMcpService baiduMapMcpService;

  @Autowired
  @Qualifier("aMapMcpService")
  private MapMcpService amapMcpService;

  @GetMapping("/mcp/baidu/chat")
  public Flux<String> chat(@RequestParam("question") String question) {
    return baiduMapMcpService.chat(question);
  }

  @GetMapping("/mcp/gaode/chat")
  public Flux<String> chat3(@RequestParam("question") String question) {
    return amapMcpService.chat(question);
  }
}
